<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:insert="~{include :: header('会员开通记录列表')}" />
    <th:block th:insert="~{include :: bootstrap-table-css}" />
</head>
<body class="hold-transition">
<div class="container-fluid mb-2">
    <div class="toolbar" id="toolbar" role="group">
        <form id="formId" class="form-inline">
            <input type="text" class="form-control mr-1" name="searchKey" placeholder="用户id/名称/手机号">
            <select name="memberType" class="form-control mr-1" th:with="type=${memberType}">
                <option value="">类型</option>
                <option th:each="dict : ${type}" th:text="${dict.title}" th:value="${dict.id}"></option>
            </select>
            <button type="button" class="btn btn-primary mr-1" onclick="$.table.search()">
                <i class="fa fa-search"></i>
                搜索
            </button>
            <button type="button" class="btn btn-default" onclick="$.form.reset()">
                <i class="fa fa-refresh"></i>
                重置
            </button>
        </form>
    </div>
    <table id="bootstrap-table" class="table-striped"></table>
</div>
<th:block th:insert="~{include :: footer}" />
<th:block th:insert="~{include :: bootstrap-table-js}" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('record:edit')}]];
    var removeFlag = [[${@permission.hasPermi('record:remove')}]];
    var memberStatus = [[${@dict.getType('qdx_member_status')}]];
    $(function() {
        var options = {
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            url: "/member/record/list.json",
            modalName: "会员开通记录",
            columns: [
                {
                    field: 'id',
                    title: 'id',
                },
                {
                    field: 'userName',
                    title: '用户名称'
                },
                {
                    field: 'mobile',
                    title: '手机号码'
                },
                {
                    field: 'description',
                    title: '描述'
                },
                {
                    field: 'price',
                    title: '金额',
                    formatter: function(value, row, index) {
                        return value / 100;
                    }
                },
                {
                    field: 'beginDate',
                    title: '开通日期'
                },
                {
                    field: 'endDate',
                    title: '到期日期'
                },
                {
                    field: 'status',
                    title: '状态',
                    formatter: function (value, row, index) {
                        return value === 1 ? '关闭' : '正常';
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="memberDelay(\'' + row.id + '\')"><i class="fa fa-clock-o"></i> 会员延期</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    //会员延迟
    function memberDelay(id) {
        $.modal.open("会员延期", "/member/record/delay.html?id="+id,'600px', '280px');
    }
</script>
</body>
</html>